package com.example.leetcode.prcatice;

public class Test0801 {
    public int waysToStep(int n) {
        int[]dp = new int[n+1];
        if(n<=2){
            return n;
        }
        dp[1] = 1;
        dp[2] = 2;
        dp[3] = 4;
        for (int i = 4;i<=n;i++){
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007 + dp[i - 3];
            dp[i] %= 1000000007;
        }
        return dp[n] ;
    }
}

class Demo0801{
  public static void main(String[] args) {
    Test0801 t = new Test0801();
    System.out.println(t.waysToStep(3));
  }
}